package org.googlecode.lightning.search;

import org.daragon.fulltext.index.DBIndexTool;
import org.daragon.fulltext.search.SearchTool;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * full text search's main
 * 
 * @author daragon
 * 
 */
public class FullTextFactory {

	private static DBIndexTool dbIndexTool;
	private static SearchTool dbSearchTool;

	private static ClassPathXmlApplicationContext context;

	static {
		final String[] configLocations = { "generic.beans.xml" };
		context = new ClassPathXmlApplicationContext(configLocations);
	}

	/**
	 * get database index tool
	 * 
	 * @return
	 */
	public static DBIndexTool getDbIndexTool() {
		dbIndexTool = (DBIndexTool) context.getBean("dbIndexTool");
		return dbIndexTool;
	}

	/**
	 * get database search tool
	 * 
	 * @return
	 */
	public static SearchTool getDbSearchTool() {
		dbSearchTool = (SearchTool) context.getBean("dbSearchTool");
		return dbSearchTool;
	}

}
